﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:template name="outputDocType">
      <xsl:param name="doctype" />
      <xsl:choose>
        <xsl:when test="$doctype='xhtml1-transitional'">
          <xsl:attribute name="doctype-public">-//W3C//DTD XHTML 1.0 Transitional//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='xhtml1-strict'">
          <xsl:attribute name="doctype-public">-//W3C//DTD XHTML 1.0 Strict//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='xhtml1-frameset'">
          <xsl:attribute name="doctype-public">-//W3C//DTD XHTML 1.0 Frameset//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='xhtml-basic11'">
          <xsl:attribute name="doctype-public">-//W3C//DTD XHTML Basic 1.1//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='xhtml11'">
          <xsl:attribute name="doctype-public">-//W3C//DTD XHTML 1.1//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='html4-transitional'">
          <xsl:attribute name="doctype-public">-//W3C//DTD HTML 4.01 Transitional//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/html4/transitional.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='html4-strict'">
          <xsl:attribute name="doctype-public">-//W3C//DTD HTML 4.01 Strict//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/html4/strict.dtd</xsl:attribute>
        </xsl:when>
        <xsl:when test="$doctype='html4-frameset'">
          <xsl:attribute name="doctype-public">-//W3C//DTD HTML 4.01 Frameset//EN</xsl:attribute>
          <xsl:attribute name="doctype-system">http://www.w3.org/TR/html4/frameset.dtd</xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:message terminate="yes">Unhandled doctype: <xsl:value-of select="$doctype" />
        </xsl:message>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
</xsl:stylesheet>
